<!DOCTYPE html>
<html>

{include file='public/header'}
<style>
    .layui-input-block{margin-left: 100px;}
</style>
<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">账号管理</a>
            <a><cite>提现列表</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <form class="layui-form layui-row" style="margin-top:15px;margin-bottom: 10px;">
            <div class="layui-inline">
                <label class="layui-form-label w-auto">公司主体：</label>
                    <div class="layui-input-block">
                    <select name="company_entity_id">
                        <option value="">请选择</option>
                        <option value="1">比翼鸟</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label w-auto">小程序名称：</label>
                <div class="layui-input-inline">
                    <input type="text" name="app_name" placeholder="请输入小程序名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <!-- <div class="layui-inline">
                <label class="layui-form-label w-auto">小程序ID：</label>
                <div class="layui-input-inline">
                    <input type="text" name="app_id" placeholder="请输入小程序ID" autocomplete="off" class="layui-input">
                </div>
            </div> -->
            <div class="layui-inline">
                <label class="layui-form-label w-auto">提现状态：</label>
                    <div class="layui-input-block">
                    <select name="status">
                        <option value="">请选择</option>
                        <option value="1">提现中</option>
                        <option value="2">提现成功</option>
                        <option value="3">提现失败</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label w-auto">创建时间：</label>
                <div class="layui-inline" id="time" style="display: flex;align-items: center;">
                    <div class="layui-input-inline" style="margin-right:10px">
                        <input type="text" autocomplete="off" name="start_date" id="start_date" class="layui-input"
                            placeholder="开始日期">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline">
                        <input type="text" autocomplete="off" name="end_date" id="end_date" class="layui-input"
                            placeholder="结束日期">
                    </div>
                </div>
            </div>
            <div class="layui-inline" style="margin-left:10px">
                <button class="layui-btn" lay-submit lay-filter="searchList">搜索</button>
                <button type="reset" id="resetList" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </form>
        <table id="getXpayWithdrawNo" lay-filter="getXpayWithdrawNo"></table>
    </div>
    
    <script>
        let params = {
            elem: '#getXpayWithdrawNo'
            , toolbar: '#toolbar'
            , url: '/admin/OpenWeixin/getXpayWithdrawNo' //数据接口
            , id: 'getXpayWithdrawNo'
            , limit:15
            , page:true
            , cols: [[ //表头
                { field: 'app_name', title: '小程序名称', align:'center'}
                , { field: 'app_id', title: '小程序appid', align:'center'}
                , { field: 'withdraw_no', title: '提现单号', align:'center'}
                , {field: 'status', title: '提现状态', templet: function (d) {
                        let status = ''
                        if (d.status == 1) {
                            status = '提现中';
                        } else if (d.status == 2) {
                            status = '提现成功';
                        }else if (d.status == 3) {
                            status = '提现失败';
                        }
                        return status
                    }, align:'center'
                }
                , { field: 'withdraw_amount',title:'提现余额', align:'center'}
                , { field: 'fail_reason',title:'提现失败原因', align:'center'}
                , { field: 'create_time', title: '创建时间', align:'center'}
                , { field: 'update_time', title: '更新时间', align:'center'}
            ]]
            , parseData:function (res) { //res 即为原始返回的数据
                if(res.code == 200){
                    return {
                        "data": res.data.data, //解析数据列表
                        "code": res.code, //解析接口状态
                        'count':res.data.total_count//解析数据长度
                    };
                }else{
                    layer.msg(res.message,{icon:5,time:1000});
                    return {
                        "data": [], //解析数据列表
                        "code": 200, //解析接口状态
                        'count':0//解析数据长度
                    };
                }
            },
        }
        tableList(params)

        layui.use(['laydate','table'], function () {
            var laydate = layui.laydate;
            var table = layui.table;
            let dayTime = dayjsFormat(new Date().getTime()/1000,false);
            //日期范围
            laydate.render({
                elem: '#time'
                , range: ['#start_date', '#end_date']
                , format: 'yyyy-MM-dd'
                , value: [dayTime,dayTime]
            });
        })
    </script>
</body>

</html>